
Partial Class ErrorRedirect
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("lastError") IsNot Nothing Then
            Me.ErrorDescriptionLabel.Text = Session("lastError")
        Else
            Me.ErrorDescriptionLabel.Text = "Information not Available"
        End If
    End Sub

    Protected Sub SendButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendButton.Click
        Dim hostServer As String = Application("EmailServer")
        Dim adminEmail As String = Application("EmailFromAddress")
        Dim adminDisplayName As String = Application("EmailFromDisplayName")
        Dim errorSubject As String = "Report of Error in " & Application("AppName") & " Application"
        Dim bodyText As StringBuilder = New StringBuilder("An error has occurred in the application, and the user has elected to report the error to you.")
        bodyText.Append(vbCrLf)
        bodyText.Append("A description of the error is detailed below.  For further information,")
        bodyText.Append("please look at the error log file.")
        bodyText.Append(vbCrLf)
        bodyText.Append(vbCrLf)
        bodyText.Append(Me.ErrorDescriptionLabel.Text.Replace("<BR>", vbCrLf))
        Cdm.AppServices.SendEmail.Send(hostServer, adminEmail, adminDisplayName, adminEmail, errorSubject, bodyText.ToString())
        Me.MessageSentLabel.Visible = True

    End Sub
End Class
